<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>收藏页面</title>
    <link rel="stylesheet" type="text/css" href="${ctxPath}/static/assets/aui/css/aui.css" />
    <!-- jQuery Include -->
    <script type="text/javascript" src="${ctxPath}/static/assets/scripts/jquery.min.js"></script>
    <style>
    </style>
</head>
<body>
<div class="aui-content aui-margin-b-15">
    <ul class="aui-list aui-media-list">
        <li >
            <header class="aui-bar aui-bar-nav">
                <a class="aui-pull-left aui-btn" onclick='retn()'>
                    <span class="aui-iconfont aui-icon-left"></span>返回
                </a>
                <div class="aui-title">用户收藏列表</div>
            </header>
        </li>
    </ul>
    <div style="display: none;text-align: center;height: 2rem;width: 100%;font-size: 14px;color: gray;margin-top: 1rem;" id="baseInfo">
        <i class="aui-iconfont aui-icon-info"></i>&nbsp;&nbsp;暂时没有收藏的技师
    </div>
</div>
</body>
<script>
    var  user=localStorage.getItem("userInfo");//以“key”为名称存储一个值“value”
    if(!user){
        location.href="${ctxPath}/wechat/public/toLoginPage";//未实现
    }
    $("#img").show();
    var obj = JSON.parse(user); // --> parse error

    $(function(){
        init(obj);
    })
    function init(obj) {
        $.ajax({
            type: "POST",
            url: "${ctxPath}/consumerCollection/search/"+obj.id,
            dataType: "json",
            success: function (result) {
                if (result.status == "0000") {
                    var  arts=result.data;
                    var  str="";
                    if(arts.length>0){
                        str+="<li >\n" +
                            "            <header class=\"aui-bar aui-bar-nav\">\n" +
                            "                <a class=\"aui-pull-left aui-btn\" onclick='retn()'>\n" +
                            "                    <span class=\"aui-iconfont aui-icon-left\"></span>返回\n" +
                            "                </a>\n" +
                            "                <div class=\"aui-title\">用户收藏列表</div>\n" +
                            "            </header>\n" +
                            "        </li>";
                        for(var i=0;i<arts.length;i++){
                            var art=arts[i];
                            str+="   <li class=\"aui-list-item aui-list-item-middle\">\n" +
                                "            <div class=\"aui-media-list-item-inner\">\n" +
                                "                <div class=\"aui-list-item-media wechat-avatar\">\n" +
                                "                    <img src=http://www.tyler.org.cn/"+art.imgUrl+"?x-oss-process=image/resize,h_77/circle,r_300/format,png>\n" +
                                "                </div>\n" +
                                "                <div class=\"aui-list-item-inner\">\n" +
                                "                    <div class=\"aui-list-item-text\">\n" +
                                "                        <div class=\"aui-list-item-title\">"+art.name+"</div>\n" +
                                "                        <div class=\"aui-list-item-right\">"+art.serviceArea+"</div>\n" +
                                "                    </div>\n" +
                                "                    <div class=\"aui-list-item-text aui-font-size-12\" title='"+art.remark+"' style=\"cursor:pointer\">\n" +
                                "                      "+art.remark.substr(0,20)+"\n" +
                                "                    </div>\n" +
                                "                </div>\n" +
                                "            </div>\n" +
                                "        </li>";
                        }
                        $("#baseInfo").hide();
                    }else{
                        str+="<li >\n" +
                            "            <header class=\"aui-bar aui-bar-nav\">\n" +
                            "                <a class=\"aui-pull-left aui-btn\"  onclick='retn()'>\n" +
                            "                    <span class=\"aui-iconfont aui-icon-left\"></span>返回\n" +
                            "                </a>\n" +
                            "                <div class=\"aui-title\">用户收藏列表</div>\n" +
                            "            </header>\n" +
                            "        </li>";
                        $("#baseInfo").show();
                    }
                    $(".aui-list").html(str);
                }
            }
        });
    }

    function retn() {
        location.href ="${ctxPath}/wechat/public/toMinePage";
    }
</script>
</html>